package day20;

import java.io.File;
//查找电脑中所有的avi文件
public class File03 {
    public static void main(String[] args) {
        File[] roots = File.listRoots();
        for (File root : roots) {
            File f=new File(root.getAbsolutePath());
            ifDictionary(f);
        }
    }

    private static void ifDictionary(File path) {
        try {
            File[] files = path.listFiles();
            for (File file : files) {
                if (file.isDirectory()) {
                    ifDictionary(file);
                } else {
                    ifAVI(file);
                }
            }}
        catch(SecurityException|NullPointerException e){

            }
    }
    private static void ifAVI(File path){
        if(path.getName().toLowerCase().endsWith(".avi")){System.out.println(path.getAbsolutePath());}
    }
}
